fix: 🐛 use duckplyr to read Parquet as DuckDB - #348
Merged
Conversation
Contributor
Author
|
I assume that the failing GHA is a fastreg thing and not on my end, but let me know if I should look into it. |
lwjohnst86
requested changes
Jul 17, 2026
lwjohnst86
left a comment
Member
There was a problem hiding this comment.
Nice! Just some comments
Contributor
Author
|
I've updated the PR to keep the outputs as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Changes
read_parquet_dataset()andread_parquet_file()to useduckplyr::read_parquet_duckdb()instead ofarrow::open_dataset()/arrow::read_parquet()This provides more robust support for duckplyr verbs and avoids errors/bugs as mentioned in #346.
Closes #346
The change to the functions is small, and only a few edits to test-read.R and test-use.R were necessary. The only substantial change to the tests is the removal of the test for incompatible schemas in test-read.R, which was necessary because duckplyr::read_parquet_duckdb handles this very differently from how arrow::open_dataset() does: if a variable's type differs between Parquet files, it is silently/automatically converted/promoted to a compatible type if at all possible and no error is thrown. I could not find a an option/flag to change this behavior.
I'd argue that, as a user this is actually the preferable behavior, since it doesn't require debugging/re-running the whole conversion, but just a single
mutate()call to force the desired type.I've kept the use of
arrow::open_datasetin test-convert.R untouched for two reasons:duckplyr::read_parquet_duckdbleads to some minor discrepancies in types and attributes in the data (described in the linked issue) that causeexpect_identical()to fail vs.haven-read tables, so it's a bit more messy to run those tests with duckplyr in the pipeline.Needs a quick/thorough review.
Checklist
just run-all